
$(function () {
    let form = layui.form
        ,laydate = layui.laydate,
        layer = layui.layer,
        table = layui.table;

    let i=0;

    $('.add-btn').click(function () {
        i++;
        addstrs1(i);
        form.render();
    });

    $(document).on("click",".btn-del",function () {
         var pre = $(this);
        layer.confirm('确定要删除么？',{
                btn:['确定','取消']
        },function () {
            $(pre).parent().parent().remove();
            layer.closeAll('dialog');
        })

        //
    });


    function getRandomNum() {
        return parseInt(Math.random()*50);
    }
    function addstrs1(i) {
//        let  iNums = getRandomNum();
        let  strs1 = `<tr>
                          <td>
                              <input type="text" name="number${i}" class="layui-input" value="${i}">
                              <input type="hidden" name="docFlag{i}" value="0"/>
                          </td>
                           <td>
                               <input type="text"  name="docName${i}" class="layui-input" id="docName${i}" >
                           </td>
                            <td>
                                 <select name="noneEmpty${i}" lay-filter="noneEmpty" id="noneEmpty${i}">
                                    <option value="">请选择</option>
                                    <option value="0">否</option>
                                     <option value="1">是</option>
                                </select>
                            </td>
                            <td>
                                 <input type="text" name="docRemarks${i}" class="layui-input">
                            </td>
                             <td style="text-align: center"><button type="button" class="layui-btn layui-btn-danger btn-del">删除</button></td>
                       </tr>`;
        $('.addlists').append(strs1);
    }



})
